package com.adou.multi.multi_tenancy.util;

import lombok.extern.slf4j.Slf4j;
/**
 * 原子变量
 * @author ADou
 *
 */
@Slf4j
public class TeanantContext {
	private TeanantContext(){}
	
	private static final InheritableThreadLocal<String> currentTenant = new InheritableThreadLocal<>();

    public static void setTenantId(String tenantId) {
    	currentTenant.set(tenantId);
    }
    
    public static String getTenantId(){
    	return currentTenant.get();
    }

    public static void clear(){
    	currentTenant.remove();
    }
}
